<?php
	/**
	*
	*@author 罟宁
	*data 2015年4月1日 上午11:12:44
	*
	*/
	include 'mysql_connect.php';
	header("content-Type:text/html;charset=utf-8");
	/* 创建数据表(仅第一次运行)
	 * @return boolean
	 * @author guning
	 * @datetime 2015年4月1日11:39:59
	 */
	function CreateTabel($dbname){
	    //创建数据表
	    if (Linking()) {
	    	//lost&found
	        $TB1_sql = "CREATE TABLE `".$dbname."`.`lost&found` (`id` int(10) NOT NULL AUTO_INCREMENT, `lost&found` varchar(10) COLLATE utf8_unicode_ci NOT NULL , `title` varchar(20) COLLATE utf8_unicode_ci NOT NULL , `date` INT(20)  NOT NULL , `place` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `class` varchar(10) COLLATE utf8_unicode_ci NOT NULL ,`detail` text COLLATE utf8_unicode_ci NOT NULL, `contacter` varchar(10) COLLATE utf8_unicode_ci NOT NULL , `tel` varchar(11) COLLATE utf8_unicode_ci NOT NULL , `qq` varchar(15) COLLATE utf8_unicode_ci NOT NULL ,`position` varchar(10) COLLATE utf8_unicode_ci NOT NULL , `Dtime` int(20) NOT NULL , PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
            //echo $TB1_sql;
            $TB_result=mysql_query($TB1_sql);
	        if (!$TB_result){
	            echo '数据表创建失败';
	            return false;
	        }else {
	            return true;
	        }
	    }
	}
    $Mhostname = SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT;
    $Shostname = SAE_MYSQL_HOST_S.':'.SAE_MYSQL_PORT;
    $dbuser = SAE_MYSQL_USER;
    $dbpass = SAE_MYSQL_PASS;
    $dbname = SAE_MYSQL_DB;
    CreateTabel($dbname);

	
	 /* 数据库不存在时，创建数据库和数据表
	 * @return boolean
	 * @author guning
	 * @datetime 2015年4月1日11:14:53
	 */
	/*function CreateDB($dbname){
	    //创建数据库
	    $DB_sql="CREATE DATABASE `".$dbname."` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
	    $DB_result=mysql_query($DB_sql);
	    if ($DB_result){
	        CreateTabel($dbname);
	    }else {
	        echo '数据库创建失败';
	        return false;
	    }
	}*/
?>
